package com.itheima.fanxing;

import com.itheima.domain.Student;

import java.util.Arrays;

public interface Inter<E> {
    void sing(E e);
}
//第一种实现泛型接口的方式 直接把继承下来
class InterImpl<E> implements Inter<E>{
    @Override
    public void sing(E e) {
        System.out.println(e);
    }
}
//第二种实现泛型接口的方式   直接声明好具体的类型
class InterImpl2 implements Inter<String>{


    @Override
    public void sing(String string) {
        System.out.println(string.length());
        char[] chars = string.toCharArray();
        System.out.println(Arrays.toString(chars));
    }
}


class Test{

    public static void main(String[] args) {
        InterImpl<Integer> ii = new InterImpl<>();
        ii.sing(123);
        InterImpl<Student> si = new InterImpl<>();
        si.sing(new Student("zhangsan ",18));


        InterImpl2 ii2 = new InterImpl2();
        ii2.sing("只因你太美");
    }
}